import 'package:flutter/material.dart';
import 'package:flutter_syt/domain/widgets/list_item.dart';
import 'package:flutter_syt/theme/theme_color.dart';

class MineListItem extends StatelessWidget {
  final ListItemEntity listData;

  const MineListItem(this.listData) : super();

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      behavior: HitTestBehavior.opaque,
      onTap: listData.onTap,
      child: Padding(
        padding: EdgeInsets.only(left: 15, right: 15),
        child: Container(
          padding: EdgeInsets.fromLTRB(0, 15, 0, 15),
          decoration: BoxDecoration(
            border: listData.isShowBorder
                ? Border(
                    bottom:
                        BorderSide(width: 0.5, color: ThemeColor.dividerColor),
                  )
                : null,
          ),
          child: Row(
            // mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Visibility(
                  visible: listData.imageUrl != null,
                  child: Padding(
                    padding: EdgeInsets.only(right: 10),
                    child: Image.asset(
                      listData.imageUrl ?? '',
                      width: 18,
                    ),
                  )),
              Expanded(
                  child: Text(
                "${listData.leftText}",
                style: listData.leftTextStyle,
              )),
              SizedBox(
                width: 12,
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.end,
                // mainAxisAlignment: MainAxisAlignment.spaceAround,
                // crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  listData.customRight ?? Text(''),
                  Container(
                    padding: EdgeInsets.only(right: 10, left: 10),
                    child: Text(
                      // 'gdf',
                      "${listData.rightText}",

                      textAlign: TextAlign.right,
                      style: TextStyle(
                        color: ThemeColor.colorBlack100,
                        fontSize: 16,
                        fontWeight: FontWeight.w300,
                      ),
                      maxLines: 2,
                      overflow: TextOverflow.ellipsis,
                    ),
                  ),
                  listData.isShowRightIcon
                      ? Container(
                          padding: EdgeInsets.only(top: 2),
                          alignment: Alignment.center,
                          child: Image.asset(
                            listData.iconRight,
                            width: 8,
                          ),
                        )
                      : Text(''),
                ],
              ),
            ],
          ),
        ),
      ),
    );
  }
}
